<h1>
	<?php echo $this->Html->image('bootstrap/posts.png')?>
	缺票登记 
</h1>
<div id = "search_bar" class="bloc stoolbar" style = 'display:none'>
	<div class="title">
		<span>搜索</span>
	</div>
    <div id = 'search_data_form' class="content" style = 'display:block;'>
    	<?php echo $this->Form->create('TicketBook',array('onsubmit'=>'return false;'));?>
    	<?php echo $this->Form->input('name',array('label'=>'用户名','class'=>'short'));?>
    	<?php echo $this->Form->input('from',array('class'=>'datepicker'));?>
    	<?php echo $this->Form->input('to',array('class'=>'datepicker'));?>
    	<?php echo '<div class=input style=""><label>　</label>'.$this->Html->link('搜索','javascript:Gootop.dialogSearchAction();',array('class'=>'button')).'</div>';?>
    	<?php echo $this->Form->end();?>
        <div class="clear"></div>
    </div>
</div>

<div class="bloc">
	<div class="title">
		<?php echo $this->element('admin/bread')?>
		<p>
            <?php echo $this->Html->link('','javascript:;',array('class'=>'search toolbar','title'=>'搜索','onclick'=>'javascript:Gootop.showSearchBar()'))?>
			<?php echo $this->Html->link('',array('admin'=>true,'plugin'=>false,'controller'=>'Tickets','action'=>'add'),array('class'=>'new toolbar','title'=>'添加'))?>
        </p>
	</div>
    <div class="content grid_content">
    	<!-- start content -->  
			<div style="width: 100%; height: 100%">
				<table id="grid_page"></table>
				<div id="pv_page"></div>
			</div>
		<!-- end content -->
	</div>
</div>
<script type="text/javascript">
Gootop.addDataGridOp = function(){
	var ids = jQuery("#grid_page").jqGrid('getDataIDs'); 
	 for(var i=0;i < ids.length;i++){ 
		 var cl = ids[i]; 
		 op0 = "<a href = '"+GM.RootScript+"admin/TicketBooks/state/"+cl+"' title = '标记已经处理' class = 'add'>处理</a>";
		 op1 = "<a href = '"+GM.RootScript+"admin/TicketAdvisories/index/"+cl+"' title='票品咨询' class = 'ask'>详细</a>"; 
		 jQuery("#grid_page").jqGrid('setRowData',ids[i],{act:op0}); 
	};
};

Gootop.dialogSearchAction = function(){
	var target =jQuery("#grid_page"); 
	var data=jQuery("#search_data_form form").serializeObject();
	target.jqGrid('setGridParam',{search:true,postData:data});
	target.trigger("reloadGrid");
};

$(function() {
    $( "#UserFrom" ).datepicker({
        defaultDate: '',
        changeMonth: true,
        numberOfMonths: 1,
        dateFormat:'yy-mm-dd',
        onClose: function( selectedDate ) {
            $( "#UserTo" ).datepicker( "option", "minDate", selectedDate );
        }
    });
    $( "#UserTo" ).datepicker({
        defaultDate: '',
        changeMonth: true,
        numberOfMonths: 1,
        dateFormat:'yy-mm-dd',
        onClose: function( selectedDate ) {
            $( "#UserFrom" ).datepicker( "option", "maxDate", selectedDate );
        }
    });
});
Gootop.confirmClose = function(){
	if(confirm("确认关闭？")){
		return true;
	}
	return false;
};
</script>
<style type="text/css">
.grid_content {
	padding: 0 !important;
}
#search_data_form .input{
	float:left;
	width:auto;
	margin-right:10px;
}
</style>
<?php echo $paginationScript; ?>